package com.well.menjin.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.well.menjin.dao.IMenuDao;
import com.well.menjin.domain.Menu;

/**
 * 
* @ClassName: MenuDaoImpl 
* @author 姜俊健 
* @date 2016年6月8日 上午11:01:30 
*
 */
@Repository
public class MenuDaoImpl implements IMenuDao {

	@Autowired
	private SessionFactory sessionFactory;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Menu> getMenus(String pid) {
		return sessionFactory.getCurrentSession().createCriteria(Menu.class)
				.add(Restrictions.eq("pid",pid))
				.addOrder(Order.asc("order_index"))
				.list();
	}



}
